package com.pro.addresslist.tools;


import java.util.Map;

import org.json.JSONObject;

import android.content.Context;
import android.widget.Toast;

import com.android.volley.Request.Method;
import com.android.volley.toolbox.JsonObjectRequest;
import com.pro.addresslist.ui.common.MyApplication;

public class VolleyRequest {
	public static NormalPostRequest jsonObjectRequest;
	
	public static void RequestJsonPost(Context mContext,String url ,String tag ,Map<String, String> mMap,VolleyInterface vif){
		Boolean NetWork= NetUtil.isNetworkAvailable(mContext);
		if(NetWork){
			MyApplication.getHttpQueue().cancelAll(tag);
			jsonObjectRequest =new NormalPostRequest(url, vif.jsonObjectListener(), vif.errorListener(),mMap){			
			};
			// 设置标签
			jsonObjectRequest.setTag(tag);
			// 加入队列
			MyApplication.getHttpQueue().add(jsonObjectRequest);
			// 启动
			MyApplication.getHttpQueue().start();
		}
		else{
			Toast.makeText(mContext, "当前网络不可用！", Toast.LENGTH_SHORT).show();
		}
		
	}
	
}
